package com.example.driftwindow.e_mail;


import com.example.driftwindow.MainActivity;
import com.example.driftwindow.R;
import com.example.driftwindow.R.id;
import com.example.driftwindow.R.layout;

import daohang.daohangMainActivity;



import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.widget.Button;

@SuppressLint("SetJavaScriptEnabled")
public class EmailActivity extends Activity{
	public static WebView webview=null;
	Button  bt=null;
	Button bs=null;

	@Override

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.email);

		

			webview =(WebView) super.findViewById(R.id.webView1);
			webview.getSettings().setJavaScriptEnabled(true);
	        webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);

			webview.getSettings().setSupportZoom(true);
			webview.getSettings().setLoadWithOverviewMode(true);
			webview.getSettings().setBuiltInZoomControls(true);
	
	    	webview.loadUrl("http://www.dengluyi.com/yxzhuyephone.htm");

	    	 webview.setWebViewClient(new webview(){
	                public boolean shouldOverrideUrlLoading(WebView view, String url) {
	                	if(url.indexOf("dengluyi")==-1){
	                		Uri uri = Uri
	                				.parse(url);
	                		Intent it = new Intent(Intent.ACTION_VIEW, uri);
	                		EmailActivity.this.startActivity(it);
	                		return true;
	                	}else{
	                    view.loadUrl(url);
	                    return true;
	                	}
	                	
	                	}
	    	 });
}
	
			public boolean onKeyDown(int keyCode,KeyEvent event){
				if((keyCode==KeyEvent.KEYCODE_BACK)&& webview.canGoBack()){
					webview.goBack();
					return true;
				}
					Intent intent=new Intent();
					intent.setClass(EmailActivity.this,MainActivity.class);
     			    startActivity(intent);
				    finish();
				    return true;
				
//				return onKeyDown(keyCode, event);
				
				}
}
